<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/jsp/common/include/taglibs.jsp"%>
<script type="text/javascript">
//오늘날짜
var nowDate = null;
//화면에 보이는 설정된 날짜
var setDate = null;

var rooms = null;

// 0,1,2,3,4,5,6 : 일,월,화,수,목,금,토
var dayOfTheWeek = "0";
//핫 튜스 롤링
var rollCnt = 1;
var rollMaxcnt=0;
function hotRolling(){
	if(rollCnt==(rollMaxcnt-1)){
		rollCnt=0;
	}
	
	$("#hotNew > div").hide();
	$("#hot"+rollCnt).slideDown();	
	rollCnt++;
}
$(document).ready(function(){
	<c:if test="${hotList !=null && fn:length(hotList)>0 }">
	rollMaxcnt = ${fn:length(hotList)};
	</c:if>
	
	<c:if test="${hotList !=null && fn:length(hotList)>1 }">
	setInterval( "hotRolling();", 2000);
	</c:if>
// 	setInterval( "hotRolling();", 2000);
	
	setDate = new Date(${fn:substring(param.reservation_dt,0,4)},${fn:substring(param.reservation_dt,4,6)-1},${fn:substring(param.reservation_dt,6,8)});
	nowDate  = new Date().toString("yyyyMMdd");
	
	//객실 정보 가져오기
	var option = {
			url: "./pere101Q.do",
			data : {"p_id":'${param.p_id}'},
			success : function(json){
				rooms = json;
				changeNewDate(0);
			}
	};
	$.getJson(option);
	
});


//테이블에 쓸 객실명 가져오기
var tableRooms="";
function getTableRooms(){
	if(tableRooms==""){
		return setTableList();
	}else{
		return tableRooms;
	}
}

function changeNewDateRedirect(num){
	var ddd = setDate.clone();
	ddd.addMonths(num);
	ddd.set({day:1});
	var pr_no_tmp = "";
	if(""!="${param.pr_no}"){
		pr_no_tmp="&pr_no=${param.pr_no}";
	}
	location.href="./pere1000Q.do?p_id=${param.p_id}&reservation_dt="+ddd.toString("yyyyMMdd")+pr_no_tmp;
}

//객실 셋팅
function setRooms(){
	
	//객실 정보 가져오기(요금, 예약현황, 연박)
	var option = {
			url: "./pere201Q.do",
			data : {"p_id":'${param.p_id}',"reservation_dt":"${param.reservation_dt}"},
			success : function(json){
				if(rooms!=null){
					var html="";
					var busy_type="";
					$.each(rooms.list, function (i) {
						var me_pr_no = this.pr_no;
						var roomMap = null;
						$.each(json.list, function (jj) {
							if(me_pr_no==this.pr_no){
								roomMap = json.list[jj];
							}
						});
						
						var use_max_cnt = this.use_max_cnt;
						var use_man_cnt = this.use_man_cnt;
						var selectHtml = "";
						var selectHtml_ch = "";
						
						//요금
						var busy_1_base = this.busy_1_base;
						var busy_1_fri = this.busy_1_fri;
						var busy_1_sat = this.busy_1_sat;
						var busy_2_base = this.busy_2_base;
						var busy_2_fri = this.busy_2_fri;
						var busy_2_sat = this.busy_2_sat;
						var busy_3_base = this.busy_3_base;
						var busy_3_fri = this.busy_3_fri;
						var busy_3_sat = this.busy_3_sat;
						
						busy_type = roomMap.busy_type;
						if(i==0){
							if("0110"==busy_type){
								$("#tdSaveBtn").hide();
							}else{
								$("#tdSaveBtn").show();
							}
						}
						
						
						var busy_1="ptrpr02";
						var busy_2="ptrpr02";
						var busy_3="ptrpr02";
						var busy_4="ptrpr02";
						var busy_5="ptrpr02";
						var busy_6="ptrpr02";
						var busy_7="ptrpr02";
						var busy_8="ptrpr02";
						var busy_9="ptrpr02";

						//이벤트일때 html
						var eventHtml = "";
						
						if(busy_type==""){
							//금요일일때
							if(dayOfTheWeek=='5'){
								busy_2="ptrpr01";
							}else if(dayOfTheWeek=='6'){
								//토요일일때
								busy_3="ptrpr01";
							}else{
								//주중일때
								busy_1="ptrpr01";
							}
							
						}else{
							
							if((null!=roomMap.pm_per && 0!=roomMap.pm_per) || (null!=roomMap.pm_dc_m && 0!=roomMap.pm_dc_m)){
								var dcType="";
								if(0!=roomMap.pm_per){
									dcType="("+roomMap.pm_per+"% 할인)";
								}else if(0!=roomMap.pm_dc_m){
									dcType="("+$.comma(roomMap.pm_dc_m)+" 원 할인)";
								}
								//할인 이벤트 일때
								eventHtml=						"				<tr align=\"center\">"+
								"					<td width=\"25%\" height=\"20\" bgcolor=\"#f5f5f5\" class=\"border2bg\">이벤트</td>"+
								"					<td width=\"25%\" class=\"border2lbg\" colspan='3'><span class=\"ptrpr01\">"+$.comma(roomMap.pm_pay)+"원"+dcType+"</span></td>"+
								"				</tr>";
								if(busy_type=='0101'){
									busy_1="ptrpr01";
								}else if(busy_type=='0102'){
									busy_2="ptrpr01";
								}else if(busy_type=='0103'){
									busy_3="ptrpr01";
								}else if(busy_type=='0104'){
									busy_4="ptrpr01";
								}else if(busy_type=='0105'){
									busy_5="ptrpr01";
								}else if(busy_type=='0106'){
									busy_6="ptrpr01";
								}else if(busy_type=='0107'){
									busy_7="ptrpr01";
								}else if(busy_type=='0108'){
									busy_8="ptrpr01";
								}else if(busy_type=='0109'){
									busy_9="ptrpr01";
								}
							}else{
								if(busy_type=='0101'){
									busy_1="ptrpr01";
								}else if(busy_type=='0102'){
									busy_2="ptrpr01";
								}else if(busy_type=='0103'){
									busy_3="ptrpr01";
								}else if(busy_type=='0104'){
									busy_4="ptrpr01";
								}else if(busy_type=='0105'){
									busy_5="ptrpr01";
								}else if(busy_type=='0106'){
									busy_6="ptrpr01";
								}else if(busy_type=='0107'){
									busy_7="ptrpr01";
								}else if(busy_type=='0108'){
									busy_8="ptrpr01";
								}else if(busy_type=='0109'){
									busy_9="ptrpr01";
								}
							}
						}
						


						
						for(var j=0; j<=use_max_cnt ; j++){
							if(use_man_cnt==j){
								selectHtml+="<option value=\""+j+"\" selected='selected'>"+j+"</option>";
									
							}else{
								selectHtml+="<option value=\""+j+"\">"+j+"</option>";
							}
							selectHtml_ch+="<option value=\""+j+"\">"+j+"</option>";
						}

						var r_img = "res_rok.gif";
						var chkYN="";
						if(me_pr_no=='${param.pr_no}'){
							chkYN=" checked='checked'";
						}
						var r_style = "<input type=\"checkbox\""+
						"			name=\"pr_no_cnts\" value=\""+i+"\" "+chkYN+">";
						if('C'==roomMap.rm_status){
							//결제 완료일때
							r_img="res_rno.gif";
							r_style = "-";
						}else if('R'==roomMap.rm_status){
							//결제 대기중일때
							r_img="res_rmi.gif";
							r_style = "-";
						}
						
						var rsv_daysHtml="";
						//연박 설정
						if(0==roomMap.fromto){
							//해당일 예약불가
							rsv_daysHtml="해당일 예약불가<input name='rsv_days' type='hidden' value='1'/>";
						}else{
							if(roomMap.fromto==null){
								rsv_daysHtml=						"<select name=\"rsv_days\">"+
								"							<option value=\"1\">1박 2일</option>"+
								"							<option value=\"2\">2박 3일</option>"+
								"							<option value=\"3\">3박 4일</option>"+
								"							<option value=\"4\">4박 5일</option>"+
								"							<option value=\"5\">5박 6일</option>"+
								"							<option value=\"6\">6박 7일</option>"+
								"							<option value=\"7\">7박 8일</option>"+
								"					</select>";
							}else{
								rsv_daysHtml+=						"<select name=\"rsv_days\">";
								for(var jjj=0;jjj<roomMap.fromto;jjj++){
									rsv_daysHtml+=						
									"							<option value=\""+(jjj+1)+"\">"+(jjj+1)+"박 "+(jjj+2)+"일</option>";
								}
								rsv_daysHtml+=						"					</select>";
							}
						}
						
						html+="	<tr align=\"center\">"+
						"		<td width=\"4%\" class=\"border2bg\"><input name='pr_nos' value='"+this.pr_no+"' type='hidden'/>"+
						r_style+
						"</td>"+
						"		<td width=\"15%\" class=\"border2lbg\"><table border=\"0\""+
						"				cellspacing=\"0\" cellpadding=\"0\">"+
						"				<tr>"+
						"					<td align=\"center\" class=\"ptrroom\">"+this.room_nm+"</td>"+
						"				</tr>"+
						"				<tr>"+
						"					<td align=\"center\"><img src=\"/usr/images/"+r_img+"\""+
						"						width=\"46\" height=\"16\"></td>"+
						"				</tr>"+
						"			</table></td>"+
						"		<td width=\"8%\" class=\"border2lbg\"><table border=\"0\""+
						"				cellspacing=\"0\" cellpadding=\"0\">"+
						"				<tr>"+
						"					<td>"+this.area_p+"평/"+this.area_m+"㎡</td>"+
						"				</tr>"+
						"			</table></td>"+
						"		<td width=\"15%\" class=\"border2lbg\"><table border=\"0\""+
						"				cellspacing=\"0\" cellpadding=\"1\">"+
						"				<tr>"+
						"					<td>기준"+use_man_cnt+" / 최대"+use_max_cnt+"</td>"+
						"				</tr>"+
						"				<tr>"+
						"					<td>성인 : <select name=\"man_cnts\" >"+
						selectHtml+
						"					</select></td>"+
						"				</tr>"+
						"				<tr>"+
						"					<td>아동 : <select name=\"chi_cnts\">"+
						selectHtml_ch+
						"					</select></td>"+
						"				</tr>"+
						"			</table></td>"+
						"		<td width=\"16%\" class=\"border2lbg\"><table border=\"0\""+
						"				cellspacing=\"0\" cellpadding=\"1\">"+
						"				<tr>"+
						"					<td class='tdSelectInfo'>"+
						rsv_daysHtml+
						"</td>"+
						"				</tr>"+
						"				<tr>"+
						"					<td align=\"center\">"+
						"						<!--img src=\"/usr/images/res_another.gif\" width=\"75\" height=\"21\" onClick=\"MM_openBrWindow('pentrip_reservation_droom.htm','','width=320,height=500')\"-->"+
						"					</td>"+
						"				</tr>"+
						"			</table></td>"+
						"		<td width=\"42%\" class=\"border2lbg\" valign=\"top\"><table"+
						"				width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">"+
						<c:if test="${'Y'==pensionInfo.busy1_yn }">
						"				<tr align=\"center\">"+
						"					<td width=\"25%\" height=\"20\" bgcolor=\"#f5f5f5\" class=\"border2bg\">비수기</td>"+
						"					<td width=\"25%\" class=\"border2lbg\"><span class=\""+busy_1+"\">"+busy_1_base+",000원</span></td>"+
							<c:if test="${'N'!=pensionInfo.friday_yn }">
							"					<td width=\"25%\" class=\"border2lbg\"><span class=\""+busy_2+"\">"+busy_1_fri+",000원</span></td>"+
							</c:if>
						"					<td width=\"25%\" class=\"border2lbg\"><span class=\""+busy_3+"\">"+busy_1_sat+",000원</span></td>"+
						"				</tr>"+
						</c:if>
						<c:if test="${'Y'==pensionInfo.busy2_yn }">
						"				<tr align=\"center\">"+
						"					<td width=\"25%\" height=\"20\" bgcolor=\"#f5f5f5\" class=\"border2bg\">준수기</td>"+
						"					<td width=\"25%\" class=\"border2lbg\"><span class=\""+busy_4+"\">"+busy_2_base+",000원</span></td>"+
							<c:if test="${'N'!=pensionInfo.friday_yn }">
							"					<td width=\"25%\" class=\"border2lbg\"><span class=\""+busy_5+"\">"+busy_2_fri+",000원</span></td>"+							
							</c:if>
						"					<td width=\"25%\" class=\"border2lbg\"><span class=\""+busy_6+"\">"+busy_2_sat+",000원</span></td>"+
						"				</tr>"+
						</c:if>
						<c:if test="${'Y'==pensionInfo.busy3_yn }">
						"				<tr align=\"center\">"+
						"					<td width=\"25%\" height=\"20\" bgcolor=\"#f5f5f5\" class=\"border2bg\">성수기</td>"+
						"					<td width=\"25%\" class=\"border2lbg\"><span class=\""+busy_7+"\">"+busy_3_base+",000원</span></td>"+
							<c:if test="${'N'!=pensionInfo.friday_yn }">
						"					<td width=\"25%\" class=\"border2lbg\"><span class=\""+busy_8+"\">"+busy_3_fri+",000원</span></td>"+				
							</c:if>
						"					<td width=\"25%\" class=\"border2lbg\"><span class=\""+busy_9+"\">"+busy_3_sat+",000원</span></td>"+
						"				</tr>"+						
						</c:if>
						eventHtml+
						"			</table></td>"+
						"	</tr>";
						
					});
					$("#rooms").html(html);
					
					if("0110"==busy_type){
						$(".tdSelectInfo").html("휴일");
					}
					
				}
			}
	};
	$.getJson(option);
}

//달력에 표시할수 있도록 테이블로 만들어둠
function setTableList(){
	//아이콘 보여줄지 여부
	var p_ico_yn = rooms.list[0].p_ico_yn;
	var html="";
	if(rooms!=null){
		$.each(rooms.list, function (i) {
			if(p_ico_yn=='Y'){
				var room_type = this.room_type;
				var img_src = "res_icon_big.gif";
				if(room_type=="F"){
					img_src ="res_icon_family.gif";
				}else if(room_type=="C"){
					img_src ="res_icon_couple.gif";
				}
				
				html+="<span class='divDel'><br/> <img src='/usr/images/"+img_src+"' width='10' height='10' border=\"0\"> "+
				"<span class=\"ptrnomal\" style=\"cursor: hand\" onMouseMove=\"trackMouse2(event)\"  "+
				"onMouseOver=\"doTooltip3(event,'할로윈','비수기주중','커플룸','원룸형','80,000원')\" "+
				"onMouseOut=\"hideTip2()\"> "+
				"<A HREF=\"/reservation/pentrip_reservation02.htm?uid=caribbean&y=2012&m=02&d=19&selectRoom=209\"> "+
				this.room_nm+"</A></span></span>";
			}else{
				html+="<span class='divDel'><br/> "+
				"<span class=\"ptrnomal\" style=\"cursor: hand\" onMouseMove=\"trackMouse2(event)\"  "+
				"onMouseOver=\"doTooltip3(event,'할로윈','비수기주중','커플룸','원룸형','80,000원')\" "+
				"onMouseOut=\"hideTip2()\"> "+
				"<A HREF=\"/reservation/pentrip_reservation02.htm?uid=caribbean&y=2012&m=02&d=19&selectRoom=209\"> "+
				this.room_nm+"</A></span></span>";
			}
			
		});
	}
	
	return html;
}

//다음달 표시 옵션
var nextMonthYn=false;

//달력을 갱신한다
function changeNewDate(plusVal){
	
	//오늘 무슨요일인지 구하기
	var dt_tmp = setDate.toString("ddd");

	//1일이 수요일이면 dateAdd = 3로 시작하기 위해 처리 0부터 시작
	for(var i=0; i < Date.CultureInfo.abbreviatedDayNames.length;i++){
		if(dt_tmp == Date.CultureInfo.abbreviatedDayNames[i]){
			dayOfTheWeek=i;
			break;
		}
	}
// 	console.log(Date.CultureInfo.abbreviatedDayNames);
	
	$(".tt").remove();
	setDate.addMonths(plusVal);
	
	setYYYYMM();
	
// 	alert(nextMonth.getDaysInMonth());
	var totalDays =setDate.getDaysInMonth();
	
	var date1 = setDate.clone();
	date1.set({day:1});
		
	var dayName = date1.toString("ddd");
	var dateAdd = 0;


	//1일이 수요일이면 dateAdd = 3로 시작하기 위해 처리 0부터 시작
	for(var i=0; i < Date.CultureInfo.abbreviatedDayNames.length;i++){
		if(dayName == Date.CultureInfo.abbreviatedDayNames[i]){
			dateAdd=i;
			break;
		}
	}

	//다음달 정보
	var chkHideMonth = setDate.getDaysInMonth()+dateAdd;
	var weekCntNext = parseInt(chkHideMonth / 7);
	if((chkHideMonth % 7)>0){
		weekCntNext++;
	}
	//weekCnt1만 씀
	
	var totalDaysAdd= totalDays+dateAdd;
	var weekCnt = parseInt(totalDaysAdd / 7);
	if((totalDaysAdd % 7)>0){
		weekCnt++;
	}

	var html="";
	for(var i=0; i < weekCnt;i++){
		html+="<tr class=\"tt\" align=\"center\" height=\"33\">";
		
		for(var j=1; j<=7;j++){
			if(j==1){
				html+="<td class=\"day"+((i*7)+j)+" redb\" bgcolor=\"#FFFFFF\" >&nbsp;&nbsp;&nbsp;</td>";
			}else if(j==7){
				html+="<td class=\"day"+((i*7)+j)+" blueb\" bgcolor=\"#FFFFFF\" >&nbsp;&nbsp;&nbsp;</td>";
			}else{
				html+="<td class=\"day"+((i*7)+j)+"\" bgcolor=\"#FFFFFF\" >&nbsp;&nbsp;&nbsp;</td>";	
			}
			
		}
		html+="</tr>";
	}
	$("#calTitle").after(html);
	
	var pr_no_tmp = "";
	if(""!="${param.pr_no}"){
		pr_no_tmp="&pr_no=${param.pr_no}";
	}
	for(var i = 1; i <= totalDays; i++ ){
		var day = date1.toString("d");
		if(i!=1 && day=="1"){
			day=date1.toString("M.d");
		}
		
		var htm_tb="<a "+
		"href=\"./pere1000Q.do?p_id=${param.p_id}&reservation_dt="+date1.toString("yyyyMMdd")+pr_no_tmp+"\" "+
			"class=\"\">"+day+"</a>";
		
		var calVal = "day_"+date1.toString("yyyyMMdd");
		
		$(".day"+(i+dateAdd)).html(htm_tb);
		$(".day"+(i+dateAdd)).html(htm_tb);
		if($(".day"+(i+dateAdd)).hasClass("blueb")){
			$(".day"+(i+dateAdd)).find("a").addClass("blueb");
		}else if($(".day"+(i+dateAdd)).hasClass("redb")){
			$(".day"+(i+dateAdd)).find("a").addClass("redb");
		}
		$(".day"+(i+dateAdd)).attr("id",calVal);
		date1.add(1).days();
	}
	
	var chkNowMonth = setDate.toString("yyyy")+setDate.toString("MM");
	var nowDateYYYYMM  = new Date().toString("yyyyMM");
	if(chkNowMonth==nowDateYYYYMM){
// 		오늘 이전 자료는 숨기기
		$(".tt").find("td").each(function (i){
			if($(this).attr("id")=="day_"+nowDate){
				return false;
			}
			
			$(this).find(".divDel").remove();;

		});	
	}else if(chkNowMonth>nowDateYYYYMM){//월이 오늘보다 크면 걍 두기
		
	}else{//이전이면 모두 어둡게 처리

	}
// 	alert(1);
// 	changeNewDate_N();
// 
// 	calTitle	타이틀

	//예약되어있는 룸 달력에 표시
	var option__ = {
		url: "./pere200_1Q.do",
		data : {"p_id":'${param.p_id}',"reservation_dt":"${param.reservation_dt}"},
		success : function(json){
			//룸 갯수
			var roomCnt = rooms.list.length;

			//달력에 색칠하기
			if(json!=null && json.list.length>0){
// 				nowDate
				
// 				Date.compare(today, future);
				var nDataChk = new Date();
				nDataChk.set({year:Number(nowDate.substr(0,4)),month:Number(nowDate.substr(4,2))-1,day:Number(nowDate.substr(6,2))});
				$.each(json.list, function (i) {
					var nDataChk1 = new Date();
					nDataChk1.set({year:Number(this.reservation_dt.substr(0,4)),month:Number(this.reservation_dt.substr(4,2))-1,day:Number(this.reservation_dt.substr(6,2))});
					
					if(nDataChk- nDataChk1<0){
						if(roomCnt==this.cnt){
							//예약 다 찬거
							$("#day_"+this.reservation_dt).attr("bgcolor","#FAFC98");
						}else{
							//예약방이 남아 있는자료
							$("#day_"+this.reservation_dt).attr("bgcolor","#FEF0FE");
						}
					}
				
				});	
			}
			//오늘 날짜 표시 
			$("#day_"+nowDate).attr("bgcolor","#e3fefe");
			//선택된 날짜표시
			var chkIcon = "<div id=\"event\" style=\"position:absolute; z-index:0 display:block;width: 45px;\">"+
				"	<img src=\"/usr/images/res_icon_today.gif\" width=\"15\" height=\"15\" border=\"0\">"+
				"</div>";
			$("#day_${param.reservation_dt}").prepend(chkIcon);
		}
	};
// 	alert(2);
	$.getJson(option__);
	//빈 테이블 그레이 처리 
	$(".tt").find("td").each(function (i){
		if($(this).html()=="&nbsp;&nbsp;&nbsp;"){
			$(this).attr("bgcolor","#F8F6F7");
		}
	});	

	
	//객실 그리기
	setRooms();
}

//메인 날짜 변경
function setYYYYMM(){
	$("#yyyyMMdd").html(setDate.toString("yyyy")+"년 "+setDate.toString("MM")+"월 "+setDate.toString("dd")+"일");
	$("#year").html(setDate.toString("yyyy"));
	$("#month").html(setDate.toString("MM"));
		
}

var send_chk=false;
//다음페이지 
function frmNext(status){
	if(send_chk){
		alert("처리중입니다.");
		return false;
	}
	if($("#reservation_nm").val()==''){
		alert("예약자명을 입력하세요");
		$("#reservation_nm").focus();
		return false;
	}
	
	if($("#r_phone2").val()==''){
		alert("휴대폰은 입력하세요");
		$("#r_phone2").focus();
		return false;
	}
	if($("#r_phone3").val()==''){
		alert("휴대폰은 입력하세요");
		$("#r_phone3").focus();
		return false;
	}
	
	if($("input[name='pr_no_cnts']:checked").length==0){
		alert("객실을 선택하세요");
		return false;
	}
	$("#rm_status").val(status);
	send_chk=true;
	$("#frmData").submit();
}


//이메일 넣기
function changeEmail(val){
	if($(val).val()==''){
		$('#r_email2').show();
	}else{
		$('#r_email2').hide();
	}
	$('#r_email2').val($(val).val());
}

//데이터 체크
function addAdmin(){
	
// 	addAdmin
	if($("#chkAdmin:checked").length==0){
		$("#reservation_nm").val("");
		$("#r_phone1").val("010");
		$("#r_phone2").val("");
		$("#r_phone3").val("");
	}else{
		
		$("#reservation_nm").val("${pensionInfo.p_usr_nm}");
		$("#r_phone1").val("${pensionInfo.p_phone1}");
		$("#r_phone2").val("${pensionInfo.p_phone2}");
		$("#r_phone3").val("${pensionInfo.p_phone3}");
	}
}
</script>
<form action="./pere1001T.do"  id="frmData" method="post">
<input type="hidden" name="p_id" value="${param.p_id}">
<input type="hidden" name="reservation_dt" id="reservation_dt" value="${param.reservation_dt}">
<input type="hidden" name="rm_status" id="rm_status" value="">
<!-- 지불방법 지금은 고정 -->
<input type="hidden" name="pay_type" id="pay_type" value="1">


<table width="100%" border="0" cellspacing="0" cellpadding="10">
	<tr>
		<td valign="top"><table width="100%" border="0" cellspacing="0"
				cellpadding="0">
				<tr>
					<td>&nbsp;</td>
				</tr>
				<tr>
					<td background="/usr/images/mypage_m01bg.gif"><table
							width="100%" border="0" cellspacing="0" cellpadding="0">
							<tr>
								<td width="40%"><img src="/usr/images/res_m01.gif"
									width="262" height="22"></td>
								<td width="60%" align="right"><%@ include file="/WEB-INF/jsp/usr/pe/re/pere_top.jsp"%></td>
							</tr>
						</table></td>
				</tr>
				<tr>
					<td height="20" background="/usr/images/res_mbg.gif"
						bgcolor="#F4F4F4">&nbsp;</td>
				</tr>
			</table> <SCRIPT language="javaScript" type="text/javascript"
				SRC="/js/check.js"></SCRIPT>
			<table width="100%" border="0" cellspacing="0" cellpadding="0">
					<tr>
						<td width="50%" align="center"><table border="0"
								cellspacing="0" cellpadding="0">
								<tr>
									<td width="70" align="left"><img
										src="/usr/images/reservation_icon_home.gif" width="47"
										height="31"></td>
									<td><IMG
										SRC="${pensionInfo.p_logo }"
										BORDER="0" height="30"></td>
								</tr>
							</table></td>
						<td width="50%">&nbsp;</td>
					</tr>
					<tr>
						<td align="center" style="padding-bottom: 5px; padding-top: 10px;"><table
								width="75%" border="0" cellspacing="0" cellpadding="0">
								<tr>
					                <td width="53"><a href="#" onclick="changeNewDateRedirect(-1);"><img src="/usr/images/res_lastm.gif" width="53" height="13"></a></td>
					                <td align="center" class="ptrroom" style="padding-top: 2px;" id="yyyyMMdd"></td>
					                <td width="53" align="right"><a href="#" onclick="changeNewDateRedirect(1);"><img src="/usr/images/res_nextm.gif" width="53" height="13"></a></td>
								</tr>
							</table></td>
						<td align="right" class="greenb2">관리자예약</td>
					</tr>
			</table>
			<table width="100%" border="0" cellspacing="0" cellpadding="0">
				<tr>
					<td width="50%" align="left" valign="top"><table border="0"
							cellspacing="0" cellpadding="3" width="97%">
							<tr>
								<td align="center" bgcolor="#EBE9EA">
									<table width="100%" border="0" cellpadding="0" cellspacing="1"
										bgcolor="#f1f1f1">
										<tr>
											<td height="30" colspan="7" align="left" bgcolor="#FEFCFD"><table
													border="0" cellspacing="0" cellpadding="0">
													<tr>
														<td width="10">&nbsp;</td>
														<td class="month2" id="month">02</td>
														<td class="year2" id="year">2012</td>
													</tr>
												</table></td>
										</tr>
										<tr align="center" id="calTitle">
											<td width="47" height="13" bgcolor="#FD636B"><img
												src="/usr/images/realtime_sun.jpg" width="45" height="13"></td>
											<td width="47"><img src="/usr/images/realtime_mon.jpg"
												width="45" height="13"></td>
											<td width="47"><img src="/usr/images/realtime_tue.jpg"
												width="45" height="13"></td>
											<td width="47"><img src="/usr/images/realtime_wed.jpg"
												width="45" height="13"></td>
											<td width="47"><img src="/usr/images/realtime_thu.jpg"
												width="45" height="13"></td>
											<td width="47" bgcolor="#85AD29"><img
												src="/usr/images/realtime_fri.jpg" width="45" height="13"></td>
											<td width="47" bgcolor="#4EA7FB"><img
												src="/usr/images/realtime_sat.jpg" width="45" height="13"></td>
										</tr>
									</table>
								</td>
							</tr>
						</table> <!--table width="100%" border="0" cellspacing="0">
              <tr>
                <td height="25" align="center" valign="bottom"><input type="submit" name="button" id="button" value="무통장입금확인"></td>
              </tr>
            </table--></td>
					<td width="50%" valign="top"><table width="100%" border="0"
							align="center" cellpadding="0" cellspacing="1" bgcolor="#d8d8d8">
							<tr>
								<td width="90" height="3" bgcolor="#60c930"></td>
								<td></td>
							</tr>
							<tr>
								<td height="24" align="center" bgcolor="#FEFEF6"><table
										border="0" cellspacing="0" cellpadding="0">
										<tr>
											<td align="center" class="greenb">예약자명</td>
										</tr>
									</table></td>
								<td bgcolor="#FFFFFF" class="ptradpadl10"><input
									type="text" name="reservation_nm" id="reservation_nm" value="">
									<label><input type="checkbox" name="" id="chkAdmin" onclick="addAdmin();" value=""/>관리자입력</label>
									
								</td>
							</tr>
							<tr>
								<td height="24" align="center" bgcolor="#FEFEF6"><table
										border="0" cellspacing="0" cellpadding="0">
										<tr>
											<td align="center" class="greenb">휴대폰</td>
										</tr>
									</table></td>
								<td bgcolor="#FFFFFF" class="ptradpadl10"><select
									name="r_phone1" id="r_phone1">
<c:if test="${code1List !=null && fn:length(code1List)>0 }">
	<c:forEach var="map1" items="${code1List}" varStatus="status">
		<option value="${map1.code }">${map1.code }</option>
	</c:forEach>
</c:if>
								</select> - <input name="r_phone2" type="text" id="r_phone2" size="4"
									value="" maxlength="4"> - <input name="r_phone3" type="text"
									id="r_phone3" size="4" value="" maxlength="4"></td>
							</tr>
						<c:if test="${'Y'==pensionInfo.end_time_yn }">
							<tr>
								<td height="24" align="center" bgcolor="#FEFEF6"><table
										border="0" cellspacing="0" cellpadding="0">
										<tr>
											<td align="center" class="greenb">도착시간</td>
										</tr>
									</table></td>
								<td bgcolor="#FFFFFF" class="ptradpadl10">
									<select name="end_time" id="end_time">
									<option value="">펜션도착시간</option>
									<c:if test="${aList4 !=null && fn:length(aList4)>0 }">
										<c:forEach var="map1" items="${aList4}" varStatus="status">
													<option value="${map1.paa_desc }">${map1.paa_desc }</option>
										</c:forEach>
									</c:if>
								</select>
								</td>
							</tr>
						</c:if>
						
						<c:if test="${'Y'==pensionInfo.email_yn }">
							<tr>
								<td height="24" align="center" bgcolor="#FEFEF6"><table
										border="0" cellspacing="0" cellpadding="0">
										<tr>
											<td align="center" class="greenb">E-mail</td>
										</tr>
									</table></td>
								<td bgcolor="#FFFFFF" class="ptradpadl10">
<input type="text"
						name="r_email1" maxlength="30" value="" style="width: 80px;"
						style="ime-mode:inactive" />@<input type="text" name="r_email2" id="r_email2"
						value=""
						style="width: 100px;" /> <select name=""
						onChange="changeEmail(this);">
							<option>이메일선택</option>
<c:if test="${code2List !=null && fn:length(code2List)>0 }">
	<c:forEach var="map1" items="${code2List}" varStatus="status">
		<option value="${map1.code }">${map1.code }</option>
	</c:forEach>
</c:if>
					</select>
								</td>
							</tr>
						</c:if>
						<c:if test="${'Y'==pensionInfo.start_time_yn }">
							<tr>
								<td height="24" align="center" bgcolor="#FEFEF6"><table
										border="0" cellspacing="0" cellpadding="0">
										<tr>
											<td align="center" class="greenb">출발지역</td>
										</tr>
									</table></td>
								<td bgcolor="#FFFFFF" class="ptradpadl10"><table border="0"
										cellspacing="0" cellpadding="0">
										<tr>
											<td>
												<input type="text" name="start_area" id="start_area" size="30" value=" ">(시,구,군 입력)
											</td>
										</tr>
									</table></td>
							</tr>
						</c:if>
						<c:if test="${'Y'==pensionInfo.pickup_yn }">
							<tr>
								<td height="24" align="center" bgcolor="#FEFEF6"><table
										border="0" cellspacing="0" cellpadding="0">
										<tr>
											<td align="center" class="greenb">픽업요청</td>
										</tr>
									</table></td>
								<td bgcolor="#FFFFFF" class="ptradpadl10"><table border="0"
										cellspacing="0" cellpadding="0">
										<tr>
											<td>
								<select name="pickup" id="pickup">
											<option value="">픽업장소</option>
										<c:if test="${aList2 !=null && fn:length(aList2)>0 }">
											<c:forEach var="map1" items="${aList2}" varStatus="status">
														<option value="${map1.paa_desc }">${map1.paa_desc }</option>
											</c:forEach>
										</c:if>
								</select>
											</td>
											<td>&nbsp;</td>
											<td>
								<select name="pick_info" id="pick_info">
										<option value="">픽업시간</option>
										<c:if test="${aList3 !=null && fn:length(aList3)>0 }">
											<c:forEach var="map1" items="${aList3}" varStatus="status">
														<option value="${map1.paa_desc }">${map1.paa_desc }</option>
											</c:forEach>
										</c:if>
								</select>
											</td>
											<td>&nbsp;</td>
											<td><input type="checkbox" name="pickup_yn" id="pickup_yn"
									value="Y"></td>
											<td class="paddtop4">요청함</td>
										</tr>
									</table></td>
							</tr>
						</c:if>
							<tr>
								<td height="24" align="center" bgcolor="#FEFEF6"><table
										border="0" cellspacing="0" cellpadding="0">
										<tr>
											<td align="center" class="greenb">입금은행</td>
										</tr>
									</table></td>
								<td bgcolor="#FFFFFF" class="ptradpadl10">
						<select name="send_bank" id="select6">
							<c:if test="${aList1 !=null && fn:length(aList1)>0 }">
								<c:forEach var="map1" items="${aList1}" varStatus="status">
											<option value="${map1.paa_desc }">${map1.paa_desc }</option>
								</c:forEach>
							</c:if>
						</select>
								</td>
							</tr>
							<tr>
								<td height="24" align="center" bgcolor="#FEFEF6"><table
										border="0" cellspacing="0" cellpadding="0">
										<tr>
											<td align="center" class="greenb">입금자명</td>
										</tr>
									</table></td>
								<td bgcolor="#FFFFFF" class="ptradpadl10"><input name="send_bank_nm" type="text" id="send_bank_nm"
										size="6"> 
										<label>
											<input type="checkbox" name="same_user" id="same_user"
											value="Y" onClick="$('#send_bank_nm').val($('#reservation_nm').val());">
											예약자명과 동일
										</label>
										</td>
							</tr>
							<!--tr>
                <td height="24" align="center" bgcolor="#FEFEF6"><table border="0" cellspacing="0" cellpadding="0">
                    <tr>
                      <td align="center" class="greenb">예약형태</td>
                    </tr>
                  </table></td>
                <td bgcolor="#FFFFFF" class="ptradpadl10"><table border="0" cellpadding="0" cellspacing="0">
                    <tr>
                      <td><input type="radio" name="payok" id="payok" value="N"></td>
                      <td width="70" class="paddtop4">입금대기</td>
                      <td><input type="radio" name="payok" id="payok" value="Y"></td>
                      <td class="paddtop4">예약완료</td>
                    </tr>
                  </table></td>
              </tr>
              <tr>
                <td height="24" align="center" bgcolor="#FEFEF6"><table border="0" cellspacing="0" cellpadding="0">
                    <tr>
                      <td align="center" class="greenb">시간설정</td>
                    </tr>
                  </table></td>
                <td bgcolor="#FFFFFF" class="ptradpadl10"><table border="0" cellpadding="0" cellspacing="0">
                    <tr>
                      <td><input type="radio" name="ltime" id="ltime" value="6"></td>
                      <td width="45" class="paddtop4">6시간</td>
                      <td><input type="radio" name="ltime" id="ltime" value="12"></td>
                      <td width="45" class="paddtop4">12시간</td>
                      <td><input type="radio" name="ltime" id="ltime" value="24"></td>
                      <td class="paddtop4">24시간</td>
                    </tr>
                  </table></td>
              </tr-->
						</table></td>
				</tr>
			</table> <br>
			<table width="100%" border="0" cellspacing="0" cellpadding="0">
				<tr>
					<td width="4" height="4"><img src="/usr/images/res_opt_t01.gif"
						width="4" height="4"></td>
					<td background="/usr/images/res_opt_t02.gif"></td>
					<td width="4"><img src="/usr/images/res_opt_t03.gif" width="4"
						height="4"></td>
				</tr>
				<tr>
					<td background="/usr/images/res_opt_m01.gif"></td>
					<td align="center"><table width="100%" border="0"
							cellspacing="2" cellpadding="0">
							<tr>
								<td height="45" bgcolor="#f6f5f5"><table width="100%"
										border="0" cellspacing="0" cellpadding="2">
										<tr align="center">
											<td width="4%">&nbsp;</td>
											<td width="15%">객실명</td>
											<td width="8%">크기</td>
											<td width="15%">인원선택</td>
											<td width="16%">기간</td>
											<td width="42%"><table width="100%" border="0"
													cellpadding="2" cellspacing="0">
													<tr align="center">
														<td width="25%" height="20" bgcolor="#f5f5f5">&nbsp;</td>
<c:if test="${'N'==pensionInfo.friday_yn }">
														<td colspan="2" class="borderbg">요금안내</td>
</c:if>
<c:if test="${'N'!=pensionInfo.friday_yn }">
														<td colspan="3" class="borderbg">요금안내</td>
</c:if>
													</tr>
													<tr align="center" valign="bottom">
														<td height="21" bgcolor="#f5f5f5">&nbsp;</td>
														<td width="25%"><img src="/usr/images/res_fee01.gif"
															width="51" height="19"></td>
<c:if test="${'N'!=pensionInfo.friday_yn }">
														<td width="25%"><img src="/usr/images/res_fee02.gif"
															width="51" height="19"></td>
</c:if>
														<td width="25%"><img src="/usr/images/res_fee03.gif"
															width="51" height="19"></td>
													</tr>
												</table></td>
										</tr>
									</table></td>
							</tr>
							<tr>
								<td
									style="border-top-color: #bfbfbf; border-top-style: solid; border-top-width: 1px;">
<!-- 									객실목록 -->
<table width="100%" border="0" cellspacing="0" cellpadding="2">
	<tbody id="rooms">
	
	</tbody>
</table>
									</td>
							</tr>
						</table></td>
					<td background="/usr/images/res_opt_m02.gif"></td>
				</tr>
				<tr>
					<td height="4"><img src="/usr/images/res_opt_b01.gif" width="4"
						height="4"></td>
					<td background="/usr/images/res_opt_b02.gif"></td>
					<td><img src="/usr/images/res_opt_b03.gif" width="4" height="4"></td>
				</tr>
			</table> <br>

      
<!-- 부가서비스 선택 -->
<c:if test="${serviceList !=null && fn:length(serviceList)>0 }">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
	<tr>
		<td style="padding-bottom: 3px;"><table width="100%" border="0"
				cellspacing="0" cellpadding="0">
				<tr>
					<td width="385"><img src="/usr/images/res_opt01.gif" width="378"
						height="13"></td>
					<td><A HREF="#;"><img src="/usr/images/res_btn_optdview.gif"
							width="68" height="18"
							onclick="alert(document.getElementById('s_int2[]').length)"></A></td>
				</tr>
			</table></td>
	</tr>
	<tr>
		<td>

			<table width="100%" border="0" cellspacing="0" cellpadding="0">
				<tr>
					<td width="4" height="4"><img src="/usr/images/res_opt_t01.gif"
						width="4" height="4"></td>
					<td background="/usr/images/res_opt_t02.gif"></td>
					<td width="4"><img src="/usr/images/res_opt_t03.gif" width="4"
						height="4"></td>
				</tr>

				<tr>
					<td background="/usr/images/res_opt_m01.gif"></td>
					<td><table width="100%" border="0" cellspacing="2"
							cellpadding="0">
							<tr>
								<td height="30" bgcolor="#f6f5f5"><table width="100%"
										border="0" cellspacing="0" cellpadding="0">
										<tr align="center">
											<td width="3%">&nbsp;</td>
											<td width="14%" class="dgrayb">서비스명</td>
											<td width="10%" align="right" class="dgrayb">이용요금</td>
											<td width="11%" align="right" class="dgrayb">주문수</td>
											<td width="31%" class="dgrayb">펜션지기 상세설명</td>
											<td width="31%" class="dgrayb">이용고객 요구사항</td>
										</tr>
									</table></td>
							</tr>
	<c:forEach var="map1" items="${serviceList}" varStatus="status">
							<tr>
								<td
									style="padding-top: 3px; border-top-color: #8b8a8a; border-top-style: solid; border-top-width: 1px;"><table
										width="100%" border="0" cellspacing="0" cellpadding="1">
										<tr>
											<td width="3%">
												<input type="hidden" name="as_nos" value="${map1.as_no }">
												<input type="checkbox" name="as_no_idxs"
												value="${status.index }"></td>
											<td width="14%" class="paddtop4">${map1.as_nm }</td>
											<td width="10%" align="right" class="ptrpr01"><fmt:formatNumber value="${map1.as_pay }" pattern="#,###"/>원</td>
											<td width="11%" align="left">&nbsp;&nbsp; <select
												name="use_cnts">
													<option value="1">1</option>
													<option value="2">2</option>
													<option value="3">3</option>
													<option value="4">4</option>
													<option value="5">5</option>
													<option value="6">6</option>
													<option value="7">7</option>
													<option value="8">8</option>
													<option value="9">9</option>
													<option value="10">10</option>
											</select> ${map1.as_unit }
											</td>
											<td width="31%" align="left">${map1.as_desc }</td>
											<td width="31%" align="center">
												${map1.as_req_memo }
												<INPUT TYPE="text"
												name="req_msgs" size="30"
												maxlength="50" value=""></td>
										</tr>
									</table></td>
							</tr>
	</c:forEach>
						</table></td>
					<td background="/usr/images/res_opt_m02.gif"></td>
				</tr>
				<tr>
					<td height="4"><img src="/usr/images/res_opt_b01.gif" width="4"
						height="4"></td>
					<td background="/usr/images/res_opt_b02.gif"></td>
					<td><img src="/usr/images/res_opt_b03.gif" width="4" height="4"></td>
				</tr>
			</table>
		</td>
	</tr>
</table>
<br>

</c:if>

<!-- 부가서비스 선택 종료 -->
			
			<table width="100%" border="0" cellspacing="0" cellpadding="0">
				<tr>
					<td>&nbsp;</td>
				</tr>
				<tr>
					<td align="center" id="tdSaveBtn"><table width="100" border="0"
							cellspacing="0" cellpadding="2">
							<tr>
								<td><A HREF="#" onclick="frmNext('R')"><img
										src="/usr/images/res_btn_standby.gif" width="114" height="36"></A></td>
								<td><A HREF="#" onclick="frmNext('C')"><img
										type="image" src="/usr/images/res_btn_okgood.gif" width="114"
										height="36"></A></td>
							</tr>
						</table></td>
				</tr>
				<tr>
					<td align="center">&nbsp;</td>
				</tr>
			</table>
			<table width="100%" border="0" cellspacing="0" cellpadding="0">
				<tr>
					<td height="3" bgcolor="#86ad29"></td>
				</tr>
				<tr>
					<td style="padding-top: 2px;"><%@ include file="/WEB-INF/jsp/usr/pe/re/footer.jsp"%></td>
				</tr>
			</table></td>
	</tr>
</table>


</form>